<script lang="ts" setup>

  import { ref } from 'vue';
  import { useRoute ,useRouter} from 'vue-router';
  import Navbar from '@/components/Navbar.vue';
  import Swipe  from '@/components/Swipe.vue';
  import { useCounterStore } from "@/stores/counter"
  const $route = useRoute()
  const $router = useRouter()
  const { img,img1,price,title,num,id } = $route.query
  const counterStore = useCounterStore()
  console.log($route.query);
  let imgs = [
      img,img1,
  ]
  const shocan =ref(true)
  const value:any = ref();
  const ccc = ref(true)
  const add = () =>{
    let data={img,title,price,num,flag:false,id}
    counterStore.getListLeft(data)
    value.value=counterStore.car.length
  }
</script>

<template>
    <div class="a">
       <Navbar title="商品详情"/>
       <Swipe :imgs="imgs"/>
       <div class="details">
          <p style="color:red">{{ price }}</p>
          <p style="font-family:Cambria, Cochin, Georgia, Times, 'Times New Roman', serif">{{ title }}</p>
       </div>
       <ul class="bottom">
          <li><b>图文详情</b></li>
          <li style="font-family:Cambria, Cochin, Georgia, Times, 'Times New Roman', serif">规格:600g~700g</li>
          <li style="font-family:Cambria, Cochin, Georgia, Times, 'Times New Roman', serif">规格:福建漳州</li>
          <li style="font-family:Cambria, Cochin, Georgia, Times, 'Times New Roman', serif">储存方式:冷藏</li>
          <li><img style="width: 100%;" :src="img" alt=""></li>
          <li><img style="width: 100%;" :src="img1" alt=""></li>
          <li><img style="width: 100%;" :src="img" alt=""></li>
          <li><img style="width: 100%;" :src="img1" alt=""></li>
          <li><img style="width: 100%;" :src="img" alt=""></li>
          <li><img style="width: 100%;" :src="img1" alt=""></li>
       </ul>
       <div class="tijiao">
         <div class="a1" @click="$router.push('/car')"><van-icon name="cart-o" color="#1989fa" :badge="value" size="17"/><p>购物车</p></div>
         <div class="a1">
          <van-icon :name="shocan ? 'like-o' :'like'" @click="shocan = !shocan" color="red"size="17"/>
          <p>收藏</p></div>
         <div>
           <van-button  type="primary"  @click="add">提交订单</van-button>
           <!-- <van-stepper v-model="value" v-show="!ccc" theme="round" button-size="22" disable-input /> -->
        </div>
       </div>
    </div>
</template>

<style scoped>
  .details{
      width: 100%;
          height: 100px;
          background: #ffffff;
          padding: 10px;
          box-sizing: border-box;
          font-size: 20px;
          color: #333;
          line-height: 20px;
          /* margin-top: 10px; */
          /* border-top: 1px solid #ccc; */
          /* border-bottom: 1px solid #ccc; */
          overflow: auto;
          padding-bottom: 50px;
          padding-top: 10px;
  }
  .a{
    background-color: #ebeaea;
    height: 100vh;
  }
  .bottom{
    height: calc(100% - 348px);
    /* background-color: aqua; */
    margin-top: 14px;
    width: 100%;
          padding: 10px;
          box-sizing: border-box;
          font-size: 20px;
          color: #333;
          line-height: 20px;
          /* margin-top: 10px; */
          /* border-top: 1px solid #ccc; */
          /* border-bottom: 1px solid #ccc; */
          overflow: auto;
          padding-bottom: 50px;
          padding-top: 10px;
  }
  .tijiao{
    width: 100%;
    height: 50px;
    background-color: #fff;
    position: fixed;
    bottom: 0;
    left: 0;
    border-top: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: space-around;
  }
  .a1{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
</style>
